module LayoutHelper
  
  def user_photo(type = nil)
    user = user_profile
    if type
      image_tag user.photo.url(type.to_sym)
    else
      image_tag user.photo.url
    end
  end
  
  def user_profile
    (@user.nil? || @user.name.nil?) ? current_user : @user
  end
  
end